package com.by.controller;

import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.transform.Result;

@RestController
@Api(tags = "用户管理")
@RequestMapping("/api")
public class UserController extends BaseController {
    @Autowired
    UserService userService;
    @ApiImplicitParam(name = "account", value = "账号", required = true, dataTypeClass = String.class, paramType = "query")
    @ApiOperation( "检查账号是否存在")
    @GetMapping("/user/check")
    public ResultBean check(@RequestParam(required = true) String account) {
        int rs = userService.checkUser(account);
        String tmp = rs == 0? "no" : "yes";
        return success("账号是否存在", tmp);
    }
}
